Building the Model: General Elements > Pre-defined Tank Subroutines > Tank_Rate

Tank_Rate

Syntax sample

TANK_RATE (<FROM tank ID>, <TO tank ID>)

TANK_RATE (TankA, TankB)

Description

MedModel calls this subroutine automatically if you pass a 0 value as the From Rate when using the Tank_Empty or Tank_Transfer subroutine. To return the desired rate value, enter the necessary logic in the subroutine—MedModel calls the subroutine with each time step. A return value of 0 terminates the flow and returns the remaining amount in the Tank_QtyLeft variable.

Components

<FROM Tank>

The name or location index number of the FROM tank (value should be 0 if there is no FROM tank).

<TO Tank>

The name or location index number of the TO tank (this value should be 0 if there is no TO tank).

Example

TankA fills with 10,000 gallons at a rate of 60 gpm until it reaches a level of 9,700 gallons. Then it fills at a rate of 30 gpm. To model this change of rate, define the following logic in the Tank_Rate subroutine:

 

IF Tank_ToID=TankA THEN

{

IF Tank_Level[TankA]<9700 THEN

RETURN 60

ELSE

RETURN 30

}

Now when you fill TankA, enter the following:

 

Tank_Fill(TankA, 10000, 0, 0)

 

The first 0 in the expression above causes the logic defined in the Tank_Rate subroutine to execute and determine the flow rate.

See Also

Varying the Transfer Rate.


© 2012 ProModel Corporation • 556 East Technology Avenue • Orem, UT 84097 • Support: 888-776-6633 • www.promodel.com